#!/usr/bin/env python

import optparse
import ConfigParser as cfg
import pdb
import sys

from qnaire import *

def main(args):
    p = optparse.OptionParser()
    p.add_option('-d', '--debug',
                 action='store_true',
                 help='run under the python debugger')
    p.add_option('-o', '--output',
                 action='store', default='qnaire.out', dest='output',
                 help='output file name')
    (o, a) = p.parse_args(args)
    if o.debug: pdb.set_trace()

    filename = a[1]
    z = Questionnaire(filename)
    confirmed = False
    while not confirmed:
        z.ask()
        confirmed = z.confirm()
    z.save(o.output)
    
if __name__ == '__main__':
    main(sys.argv)
